
<html><head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta content="text/javascript" http-equiv="content-script-type">
<title>system.math.IEEE</title>
<link rel="stylesheet" type="text/css" href="candydoc/style.css">
<!--[if lt IE 7]><link rel="stylesheet" type="text/css" href="candydoc/ie56hack.css"><![endif]-->
<script language="JavaScript" src="candydoc/util.js" type="text/javascript"></script>
<script language="JavaScript" src="candydoc/tree.js" type="text/javascript"></script>
<script language="JavaScript" src="candydoc/explorer.js" type="text/javascript"></script>
</head><body>
<div id="tabarea"></div><div id="explorerclient"></div>
<div id="content"><script>explorer.initialize("system.math.IEEE");</script>
	<table class="content">
		<tr><td id="docbody"><h1>system.math.IEEE</h1><!-- Generated by Ddoc from F:\MyWork\phoenix\source\system\math\IEEE.d -->
Low-level Mathematical Functions which take advantage of the IEEE754 ABI.
<br><br>
<b>License:</b><br>
BSD style: , Digital Mars.
<br><br>
<b>Authors:</b><br>
Don Clugston, Walter Bright, Sean Kelly
 

<br><br>

$(DDOC_MODULE_MEMBERS 

<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl">struct 
<span class="currsymbol">IeeeFlags</span>
<script>explorer.outline.addDecl('IeeeFlags');</script>

;
</span></dt>
<script>explorer.outline.writeEnabled = false;</script>


<dd>IEEE exception status flags
<br><br>
These flags indicate that an exceptional floating-point condition has occured.
 They indicate that a NaN or an infinity has been generated, that a result
 is inexact, or that a signalling NaN has been encountered.
 The return values of the properties should be treated as booleans, although
 each is returned as an int, for speed.

<br><br>
<b>Example:</b><br>
<pre class="d_code">    <font color=blue>real</font> a=3.5;
    <font color=green>// Set all the flags to zero
</font>    resetIeeeFlags();
    <font color=blue>assert</font>(!ieeeFlags.divByZero);
    <font color=green>// Perform a division by zero.
</font>    a/=0.0L;
    <font color=blue>assert</font>(a==<font color=blue>real</font>.infinity);
    <font color=blue>assert</font>(ieeeFlags.divByZero);
    <font color=green>// Create a NaN
</font>    a*=0.0L;
    <font color=blue>assert</font>(ieeeFlags.invalid);
    <font color=blue>assert</font>(isNaN(a));

    <font color=green>// Check that calling func() has no effect on the
</font>    <font color=green>// status flags.
</font>    <u>IeeeFlags</u> f = ieeeFlags;
    func();
    <font color=blue>assert</font>(ieeeFlags == f);

</pre>
 
<br><br>


<script>explorer.outline.incSymbolLevel();</script>
<dl>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl">int 
<span class="currsymbol">inexact</span>
<script>explorer.outline.addDecl('inexact');</script>

();
</span></dt>
<script>explorer.outline.writeEnabled = false;</script>


<dd>The result cannot be represented exactly, so rounding occured.
 (example: x = sin(0.1); }
)
<br><br>


<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl">int 
<span class="currsymbol">underflow</span>
<script>explorer.outline.addDecl('underflow');</script>

();
</span></dt>
<script>explorer.outline.writeEnabled = false;</script>


<dd>A zero was generated by 
<span class="currsymbol">underflow</span>
<script>explorer.outline.addDecl('underflow');</script>

 (example: x = real.min*real.epsilon/2;)
<br><br>

</dd>

<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl">int 
<span class="currsymbol">overflow</span>
<script>explorer.outline.addDecl('overflow');</script>

();
</span></dt>
<script>explorer.outline.writeEnabled = false;</script>


<dd>An infinity was generated by 
<span class="currsymbol">overflow</span>
<script>explorer.outline.addDecl('overflow');</script>

 (example: x = real.max*2;)
<br><br>

</dd>

<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl">int 
<span class="currsymbol">divByZero</span>
<script>explorer.outline.addDecl('divByZero');</script>

();
</span></dt>
<script>explorer.outline.writeEnabled = false;</script>


<dd>An infinity was generated by division by zero (example: x = 3/0.0; )
<br><br>

</dd>

<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl">int 
<span class="currsymbol">invalid</span>
<script>explorer.outline.addDecl('invalid');</script>

();
</span></dt>
<script>explorer.outline.writeEnabled = false;</script>


<dd>A machine NaN was generated. (example: x = real.infinity * 0.0; )
<br><br>

</dd>
</dd>
</dl>
<script>explorer.outline.decSymbolLevel();</script>



<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl">IeeeFlags 
<span class="currsymbol">ieeeFlags</span>
<script>explorer.outline.addDecl('ieeeFlags');</script>

();
</span></dt>
<script>explorer.outline.writeEnabled = false;</script>


<dd>Return a snapshot of the current state of the floating-point status flags.
<br><br>

</dd>

<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl">void 
<span class="currsymbol">resetIeeeFlags</span>
<script>explorer.outline.addDecl('resetIeeeFlags');</script>

();
</span></dt>
<script>explorer.outline.writeEnabled = false;</script>


<dd>Set all of the floating-point status flags to <b>false</b>.
<br><br>

</dd>

<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl">enum 
<span class="currsymbol">RoundingMode</span>
<script>explorer.outline.addDecl('RoundingMode');</script>

;
</span></dt>
<script>explorer.outline.writeEnabled = false;</script>


<dd>IEEE rounding modes.
 The default mode is ROUNDTONEAREST.
 
<br><br>

</dd>

<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl">RoundingMode 
<span class="currsymbol">setIeeeRounding</span>
<script>explorer.outline.addDecl('setIeeeRounding');</script>

(RoundingMode <span class="funcparam">roundingmode</span>);
</span></dt>
<script>explorer.outline.writeEnabled = false;</script>


<dd>Change the rounding mode used for all floating-point operations.
<br><br>
Returns the old rounding mode.
<br><br>

 When changing the rounding mode, it is almost always necessary to restore it
 at the end of the function. Typical usage:
<pre class="d_code">    <font color=blue>auto</font> oldrounding = <u>setIeeeRounding</u>(RoundingMode.ROUNDDOWN);
    <font color=blue>scope</font> (exit) <u>setIeeeRounding</u>(oldrounding);
</pre>
 
<br><br>

</dd>

<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl">RoundingMode 
<span class="currsymbol">getIeeeRounding</span>
<script>explorer.outline.addDecl('getIeeeRounding');</script>

();
</span></dt>
<script>explorer.outline.writeEnabled = false;</script>


<dd>Get the IEEE rounding mode which is in use.
<br><br>

</dd>

<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl">PrecisionControl 
<span class="currsymbol">reduceRealPrecision</span>
<script>explorer.outline.addDecl('reduceRealPrecision');</script>

(PrecisionControl <span class="funcparam">prec</span>);
</span></dt>
<script>explorer.outline.writeEnabled = false;</script>


<dd>Set the number of bits of precision used by 'real'.
<br><br>
<b>Returns:</b><br>
the old precision.
 This is not supported on all platforms.
 
<br><br>

</dd>

<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl">real 
<span class="currsymbol">frexp</span>
<script>explorer.outline.addDecl('frexp');</script>

(real <span class="funcparam">value</span>, out int <span class="funcparam">exp</span>);
</span></dt>
<script>explorer.outline.writeEnabled = false;</script>


<dd>Separate floating point <span class="funcparam">value</span> into significand and exponent.
<br><br>
<b>Returns:</b><br>
Calculate and return <i>x</i> and <span class="funcparam">exp</span> such that
  <span class="funcparam">value</span> =<i>x</i>*2 and
  .5 &lt;= |<i>x</i>| &lt; 1.0<br>
  <i>x</i> has same sign as <span class="funcparam">value</span>.
<br><br>

  <table border=1 cellpadding=4 cellspacing=0>
      <caption>Special Values</caption>
       <tr> <th> <span class="funcparam">value</span>          <th> returns        <th> <span class="funcparam">exp</span>
  <tr> <td> &plusmn;0.0    <td> &plusmn;0.0    <td> 0
  <tr> <td> +&infin;       <td> +&infin;       <td> int.max
  <tr> <td> -&infin;       <td> -&infin;       <td> int.min
  <tr> <td> &plusmn;<font color=red>NAN</font> <td> &plusmn;<font color=red>NAN</font> <td> int.min
  </table>
 
<br><br>

</dd>

<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl">real 
<span class="currsymbol">ldexp</span>
<script>explorer.outline.addDecl('ldexp');</script>

(real <span class="funcparam">n</span>, int <span class="funcparam">exp</span>);
</span></dt>
<script>explorer.outline.writeEnabled = false;</script>


<dd>Compute <span class="funcparam">n</span> * 2
<br><br>
<b>References:</b><br>
frexp
 
<br><br>

</dd>

<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl">int 
<span class="currsymbol">ilogb</span>
<script>explorer.outline.addDecl('ilogb');</script>

(real <span class="funcparam">x</span>);
</span></dt>
<script>explorer.outline.writeEnabled = false;</script>


<dd>Extracts the exponent of <span class="funcparam">x</span> as a signed integral value.
<br><br>
If <span class="funcparam">x</span> is not a special value, the result is the same as
 <tt>cast(int)logb(<span class="funcparam">x</span>)</tt>.

<br><br>
<b>Remarks:</b><br>
This function is consistent with IEEE754R, but it
 differs from the C function of the same name
 in the return value of infinity. (in C, 
<span class="currsymbol">ilogb</span>
<script>explorer.outline.addDecl('ilogb');</script>

(real.infinity)== int.max).
 Note that the special return values may all be equal.
<br><br>

  <table border=1 cellpadding=4 cellspacing=0>
      <caption>Special Values</caption>
       <tr> <th> <span class="funcparam">x</span>               <th>
<span class="currsymbol">ilogb</span>
<script>explorer.outline.addDecl('ilogb');</script>

(<span class="funcparam">x</span>)           <th>invalid?
  <tr> <td> 0               <td> FP_ILOGB0         <th> yes
  <tr> <td> &plusmn;&infin; <td> FP_ILOGBINFINITY  <th> yes
  <tr> <td> <font color=red>NAN</font>          <td> FP_ILOGBNAN       <th> yes
  </table>
 
<br><br>

</dd>

<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl">real 
<span class="currsymbol">logb</span>
<script>explorer.outline.addDecl('logb');</script>

(real <span class="funcparam">x</span>);
</span></dt>
<script>explorer.outline.writeEnabled = false;</script>


<dd>Extracts the exponent of <span class="funcparam">x</span> as a signed integral value.
<br><br>
If <span class="funcparam">x</span> is subnormal, it is treated as if it were normalized.
 For a positive, finite <span class="funcparam">x</span>:
<br><br>

<pre class="d_code"> 1 &lt;= <i><i>x</i></i> * FLT_RADIX &lt; FLT_RADIX
</pre>

  <table border=1 cellpadding=4 cellspacing=0>
      <caption>Special Values</caption>
       <tr> <th> <span class="funcparam">x</span>               <th> 
<span class="currsymbol">logb</span>
<script>explorer.outline.addDecl('logb');</script>

(<span class="funcparam">x</span>)  <th> Divide by 0?
  <tr> <td> &plusmn;&infin; <td> +&infin; <td> no
  <tr> <td> &plusmn;0.0     <td> -&infin; <td> yes
  </table>
 
<br><br>

</dd>

<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl">real 
<span class="currsymbol">scalbn</span>
<script>explorer.outline.addDecl('scalbn');</script>

(real <span class="funcparam">x</span>, int <span class="funcparam">n</span>);
</span></dt>
<script>explorer.outline.writeEnabled = false;</script>


<dd>Efficiently calculates <span class="funcparam">x</span> * 2.
<br><br>

<span class="currsymbol">scalbn</span>
<script>explorer.outline.addDecl('scalbn');</script>

 handles underflow and overflow in
 the same fashion as the basic arithmetic operators.
<br><br>

  <table border=1 cellpadding=4 cellspacing=0>
      <caption>Special Values</caption>
       <tr> <th> <span class="funcparam">x</span>                <th> scalb(<span class="funcparam">x</span>)
  <tr> <td> &plusmn;&infin; <td> &plusmn;&infin;
  <tr> <td> &plusmn;0.0      <td> &plusmn;0.0
  </table>
 
<br><br>

</dd>

<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl">real 
<span class="currsymbol">fdim</span>
<script>explorer.outline.addDecl('fdim');</script>

(real <span class="funcparam">x</span>, real <span class="funcparam">y</span>);
</span></dt>
<script>explorer.outline.writeEnabled = false;</script>


<dd>Returns the positive difference between <span class="funcparam">x</span> and <span class="funcparam">y</span>.
<br><br>
If either of <span class="funcparam">x</span> or <span class="funcparam">y</span> is <font color=red>NAN</font>, it will be returned.
<br><br>
<b>Returns:</b><br>
<table border=1 cellpadding=4 cellspacing=0>
      <caption>Special Values</caption>
       <tr><th>Arguments</th> <th>
<span class="currsymbol">fdim</span>
<script>explorer.outline.addDecl('fdim');</script>

(<span class="funcparam">x</span>, <span class="funcparam">y</span>)</th></tr>
  <tr><td><span class="funcparam">x</span> &gt; <span class="funcparam">y</span></td> <td><span class="funcparam">x</span> - <span class="funcparam">y</span></td></tr>
  <tr><td><span class="funcparam">x</span> &lt;= <span class="funcparam">y</span></td> <td>+0.0</td></tr>
 </table>
 
<br><br>

</dd>

<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl">real 
<span class="currsymbol">fabs</span>
<script>explorer.outline.addDecl('fabs');</script>

(real <span class="funcparam">x</span>);
</span></dt>
<script>explorer.outline.writeEnabled = false;</script>


<dd>Returns |<span class="funcparam">x</span>|
<br><br>
<table border=1 cellpadding=4 cellspacing=0>
      <caption>Special Values</caption>
       <tr> <th> <span class="funcparam">x</span>               <th> 
<span class="currsymbol">fabs</span>
<script>explorer.outline.addDecl('fabs');</script>

(<span class="funcparam">x</span>)
  <tr> <td> &plusmn;0.0     <td> +0.0
  <tr> <td> &plusmn;&infin; <td> +&infin;
  </table>
 
<br><br>

</dd>

<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl">real 
<span class="currsymbol">fma</span>
<script>explorer.outline.addDecl('fma');</script>

(float <span class="funcparam">x</span>, float <span class="funcparam">y</span>, float <span class="funcparam">z</span>);
</span></dt>
<script>explorer.outline.writeEnabled = false;</script>


<dd>Returns (<span class="funcparam">x</span> * <span class="funcparam">y</span>) + <span class="funcparam">z</span>, rounding only once according to the
 current rounding mode.
<br><br>
<font color=red>BUGS:</font><br>
Not currently implemented - rounds twice.
 
<br><br>

</dd>

<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl">creal 
<span class="currsymbol">expi</span>
<script>explorer.outline.addDecl('expi');</script>

(real <span class="funcparam">y</span>);
</span></dt>
<script>explorer.outline.writeEnabled = false;</script>


<dd>Calculate cos(<span class="funcparam">y</span>) + i sin(<span class="funcparam">y</span>).
<br><br>
On x86 CPUs, this is a very efficient operation;
 almost twice as fast as calculating sin(<span class="funcparam">y</span>) and cos(<span class="funcparam">y</span>)
 seperately, and is the preferred method when both are required.
 
<br><br>

</dd>

<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl">int 
<span class="currsymbol">isNaN</span>
<script>explorer.outline.addDecl('isNaN');</script>

(real <span class="funcparam">x</span>);
</span></dt>
<script>explorer.outline.writeEnabled = false;</script>


<dd>Returns !=0 if e is a NaN.
 
<br><br>

</dd>

<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl">int 
<span class="currsymbol">isNormal</span>
<script>explorer.outline.addDecl('isNormal');</script>

(X)(X <span class="funcparam">x</span>);
</span></dt>
<script>explorer.outline.writeEnabled = false;</script>


<dd>Returns !=0 if x is normalized.
<br><br>
(Need one for each format because subnormal
  floats might be converted to normal reals)
 
<br><br>

</dd>

<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl">bool 
<span class="currsymbol">isIdentical</span>
<script>explorer.outline.addDecl('isIdentical');</script>

(real <span class="funcparam">x</span>, real <span class="funcparam">y</span>);
<br>bool 
<span class="currsymbol">isIdentical</span>
<script>explorer.outline.addDecl('isIdentical');</script>

(ireal <span class="funcparam">x</span>, ireal <span class="funcparam">y</span>);
<br>bool 
<span class="currsymbol">isIdentical</span>
<script>explorer.outline.addDecl('isIdentical');</script>

(creal <span class="funcparam">x</span>, creal <span class="funcparam">y</span>);
</span></dt>
<script>explorer.outline.writeEnabled = false;</script>


<dd>Is the binary representation of <span class="funcparam">x</span> identical to <span class="funcparam">y</span>?
<br><br>
Same as ==, except that positive and negative zero are not identical,
 and two <font color=red>NAN</font>s are identical if they have the same 'payload'.
 
<br><br>

</dd>

<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl">int 
<span class="currsymbol">isSubnormal</span>
<script>explorer.outline.addDecl('isSubnormal');</script>

(float <span class="funcparam">f</span>);
<br>int 
<span class="currsymbol">isSubnormal</span>
<script>explorer.outline.addDecl('isSubnormal');</script>

(double <span class="funcparam">d</span>);
<br>int 
<span class="currsymbol">isSubnormal</span>
<script>explorer.outline.addDecl('isSubnormal');</script>

(real <span class="funcparam">x</span>);
</span></dt>
<script>explorer.outline.writeEnabled = false;</script>


<dd>Is number subnormal? (Also called "denormal".)
 Subnormals have a 0 exponent and a 0 most significant significand bit,
 but are non-zero.
 
<br><br>

</dd>

<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl">int 
<span class="currsymbol">isZero</span>
<script>explorer.outline.addDecl('isZero');</script>

(real <span class="funcparam">x</span>);
</span></dt>
<script>explorer.outline.writeEnabled = false;</script>


<dd>Return !=0 if <span class="funcparam">x</span> is &plusmn;0.
<br><br>
Does not affect any floating-point flags
 
<br><br>

</dd>

<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl">int 
<span class="currsymbol">isInfinity</span>
<script>explorer.outline.addDecl('isInfinity');</script>

(real <span class="funcparam">x</span>);
</span></dt>
<script>explorer.outline.writeEnabled = false;</script>


<dd>Return !=0 if e is &plusmn;&infin;.
 
<br><br>

</dd>

<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl">real 
<span class="currsymbol">nextUp</span>
<script>explorer.outline.addDecl('nextUp');</script>

(real <span class="funcparam">x</span>);
<br>double 
<span class="currsymbol">nextDoubleUp</span>
<script>explorer.outline.addDecl('nextDoubleUp');</script>

(double <span class="funcparam">x</span>);
<br>float 
<span class="currsymbol">nextFloatUp</span>
<script>explorer.outline.addDecl('nextFloatUp');</script>

(float <span class="funcparam">x</span>);
</span></dt>
<script>explorer.outline.writeEnabled = false;</script>


<dd>Calculate the next largest floating point value after <span class="funcparam">x</span>.
<br><br>
Return the least number greater than <span class="funcparam">x</span> that is representable as a real;
 thus, it gives the next point on the IEEE number line.
 This function is included in the forthcoming IEEE 754R standard.
<br><br>

  <table border=1 cellpadding=4 cellspacing=0>
      <caption>Special Values</caption>
         <tr><th><span class="funcparam">x</span></th> <th>            nextup(<span class="funcparam">x</span>)   </th></tr>
    <tr><td>-&infin;</td> <td>     -real.max   </td></tr>
    <tr><td>&plusmn;0.0</td> <td>  real.min*real.epsilon </td></tr>
    <tr><td>real.max</td> <td>     real.infinity </td></tr>
    <tr><td>real.infinity</td> <td>real.infinity </td></tr>
    <tr><td><font color=red>NAN</font></td> <td>       <font color=red>NAN</font>        </td></tr>
 </table>
<br><br>

 nextDoubleUp and nextFloatUp are the corresponding functions for
 the IEEE double and IEEE float number lines.
 
<br><br>

</dd>

<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl">X 
<span class="currsymbol">splitSignificand</span>
<script>explorer.outline.addDecl('splitSignificand');</script>

(X)(ref X <span class="funcparam">x</span>);
</span></dt>
<script>explorer.outline.writeEnabled = false;</script>


<dd>Reduces the magnitude of x, so the bits in the lower half of its significand
 are all zero. Returns the amount which needs to be added to x to restore its
 initial value; this amount will also have zeros in all bits in the lower half
 of its significand.
 
<br><br>

</dd>

<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl">real 
<span class="currsymbol">nextDown</span>
<script>explorer.outline.addDecl('nextDown');</script>

(real <span class="funcparam">x</span>);
<br>double 
<span class="currsymbol">nextDoubleDown</span>
<script>explorer.outline.addDecl('nextDoubleDown');</script>

(double <span class="funcparam">x</span>);
<br>float 
<span class="currsymbol">nextFloatDown</span>
<script>explorer.outline.addDecl('nextFloatDown');</script>

(float <span class="funcparam">x</span>);
</span></dt>
<script>explorer.outline.writeEnabled = false;</script>


<dd>Calculate the next smallest floating point value before <span class="funcparam">x</span>.
<br><br>
Return the greatest number less than <span class="funcparam">x</span> that is representable as a real;
 thus, it gives the previous point on the IEEE number line.
<br><br>
<b>Note:</b><br>
This function is included in the forthcoming IEEE 754R standard.
<br><br>

 Special values:
 real.infinity   real.max
 real.min*real.epsilon 0.0
 0.0             -real.min*real.epsilon
 -0.0            -real.min*real.epsilon
 -real.max        -real.infinity
 -real.infinity    -real.infinity
 NAN              NAN
<br><br>

 nextDoubleDown and nextFloatDown are the corresponding functions for
 the IEEE double and IEEE float number lines.
 
<br><br>

</dd>

<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl">real 
<span class="currsymbol">nextafter</span>
<script>explorer.outline.addDecl('nextafter');</script>

(real <span class="funcparam">x</span>, real <span class="funcparam">y</span>);
</span></dt>
<script>explorer.outline.writeEnabled = false;</script>


<dd>Calculates the next representable value after <span class="funcparam">x</span> in the direction of <span class="funcparam">y</span>.
<br><br>
If <span class="funcparam">y</span> &gt; <span class="funcparam">x</span>, the result will be the next largest floating-point value;
 if <span class="funcparam">y</span> &lt; <span class="funcparam">x</span>, the result will be the next smallest value.
 If <span class="funcparam">x</span> == <span class="funcparam">y</span>, the result is <span class="funcparam">y</span>.

<br><br>
<b>Remarks:</b><br>
This function is not generally very useful; it's almost always better to use
 the faster functions nextUp() or nextDown() instead.
<br><br>

 IEEE 754 requirements not implemented:
 The FE_INEXACT and FE_OVERFLOW exceptions will be raised if <span class="funcparam">x</span> is finite and
 the function result is infinite. The FE_INEXACT and FE_UNDERFLOW
 exceptions will be raised if the function value is subnormal, and <span class="funcparam">x</span> is
 not equal to <span class="funcparam">y</span>.
 
<br><br>

</dd>

<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl">int 
<span class="currsymbol">feqrel</span>
<script>explorer.outline.addDecl('feqrel');</script>

(X)(X <span class="funcparam">x</span>, X <span class="funcparam">y</span>);
</span></dt>
<script>explorer.outline.writeEnabled = false;</script>


<dd>To what precision is x equal to y?
<br><br>
<b>Returns:</b><br>
the number of significand bits which are equal in x and y.
 eg, 0x1.F8p+60 and 0x1.F1p+60 are equal to 5 bits of precision.
<br><br>

  <table border=1 cellpadding=4 cellspacing=0>
      <caption>Special Values</caption>
         <tr><th>x</th> <th>     y</th> <th>        
<span class="currsymbol">feqrel</span>
<script>explorer.outline.addDecl('feqrel');</script>

(x, y)  </th></tr>
    <tr><td>x</td> <td>     x</td> <td>        real.mant_dig </td></tr>
    <tr><td>x</td> <td>     &gt;= 2*x</td> <td>0 </td></tr>
    <tr><td>x</td> <td>     &lt;= x/2</td> <td>0 </td></tr>
    <tr><td><font color=red>NAN</font></td> <td>any</td> <td>      0 </td></tr>
    <tr><td>any</td> <td>   <font color=red>NAN</font></td> <td>   0 </td></tr>
  </table>

<br><br>
<b>Remarks:</b><br>
This is a very fast operation, suitable for use in speed-critical code.
 
<br><br>

</dd>

<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl">int 
<span class="currsymbol">signbit</span>
<script>explorer.outline.addDecl('signbit');</script>

(real <span class="funcparam">x</span>);
</span></dt>
<script>explorer.outline.writeEnabled = false;</script>


<dd>Return 1 if sign bit of e is set, 0 if not.
 
<br><br>

</dd>

<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl">real 
<span class="currsymbol">copysign</span>
<script>explorer.outline.addDecl('copysign');</script>

(real <span class="funcparam">to</span>, real <span class="funcparam">from</span>);
</span></dt>
<script>explorer.outline.writeEnabled = false;</script>


<dd>Return a value composed of <span class="funcparam">to</span> with <span class="funcparam">from</span>'s sign bit.
 
<br><br>

</dd>

<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl">T 
<span class="currsymbol">ieeeMean</span>
<script>explorer.outline.addDecl('ieeeMean');</script>

(T)(T <span class="funcparam">x</span>, T <span class="funcparam">y</span>);
</span></dt>
<script>explorer.outline.writeEnabled = false;</script>


<dd>Return the value that lies halfway between x and y on the IEEE number line.
<br><br>
Formally, the result is the arithmetic mean of the binary significands of x
 and y, multiplied by the geometric mean of the binary exponents of x and y.
 x and y must have the same sign, and must not be NaN.
<br><br>
<b>Note:</b><br>
this function is useful for ensuring O(log n) behaviour in algorithms
 involving a 'binary chop'.
<br><br>

 Special cases:
 If x and y are within a factor of 2, (ie, feqrel(x, y) &gt; 0), the return value
 is the arithmetic mean (x + y) / 2.
 If x and y are even powers of 2, the return value is the geometric mean,
   
<span class="currsymbol">ieeeMean</span>
<script>explorer.outline.addDecl('ieeeMean');</script>

(x, y) = sqrt(x * y).
<br><br>

 
<br><br>

</dd>

<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl">real 
<span class="currsymbol">NaN</span>
<script>explorer.outline.addDecl('NaN');</script>

(ulong <span class="funcparam">payload</span>);
</span></dt>
<script>explorer.outline.writeEnabled = false;</script>


<dd>Create a <font color=red>NAN</font>, storing an integer inside the <span class="funcparam">payload</span>.
<br><br>
For 80-bit or 128-bit reals, the largest possible <span class="funcparam">payload</span> is 0x3FFF_FFFF_FFFF_FFFF.
 For doubles, it is 0x3_FFFF_FFFF_FFFF.
 For floats, it is 0x3F_FFFF.
 
<br><br>

</dd>

<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl">ulong 
<span class="currsymbol">getNaNPayload</span>
<script>explorer.outline.addDecl('getNaNPayload');</script>

(real <span class="funcparam">x</span>);
</span></dt>
<script>explorer.outline.writeEnabled = false;</script>


<dd>Extract an integral payload from a <font color=red>NAN</font>.
<br><br>
<b>Returns:</b><br>
the integer payload as a ulong.
<br><br>

 For 80-bit or 128-bit reals, the largest possible payload is 0x3FFF_FFFF_FFFF_FFFF.
 For doubles, it is 0x3_FFFF_FFFF_FFFF.
 For floats, it is 0x3F_FFFF.
 
<br><br>

</dd>
</dd>
</td></tr>
		<tr><td id="docfooter">
			Page was generated with
			<img src="candydoc/img/candydoc.gif" style="vertical-align:middle; position:relative; top:-1px">
			on Sat Nov 29 22:33:12 2008

		</td></tr>
	</table>
</div>
<script>
	explorer.packageExplorer.addModule("platform.PAL");
	explorer.packageExplorer.addModule("platform.windows.Core");
	explorer.packageExplorer.addModule("platform.linux.Core");
	explorer.packageExplorer.addModule("system.Array");
	explorer.packageExplorer.addModule("system.BitArray");
	explorer.packageExplorer.addModule("system.Environment");
	explorer.packageExplorer.addModule("system.Event");
	explorer.packageExplorer.addModule("system.Exception");
	explorer.packageExplorer.addModule("system.Hash");
	explorer.packageExplorer.addModule("system.IntPtr");
	explorer.packageExplorer.addModule("system.Random");
	explorer.packageExplorer.addModule("system.Traits");
	explorer.packageExplorer.addModule("system.TypeTuple");
	explorer.packageExplorer.addModule("system.math.IEEE");
	explorer.packageExplorer.addModule("system.math.Math");
	explorer.packageExplorer.addModule("system.runtime.c.complex");
	explorer.packageExplorer.addModule("system.runtime.c.config");
	explorer.packageExplorer.addModule("system.runtime.c.ctype");
	explorer.packageExplorer.addModule("system.runtime.c.errno");
	explorer.packageExplorer.addModule("system.runtime.c.fenv");
	explorer.packageExplorer.addModule("system.runtime.c.inttypes");
	explorer.packageExplorer.addModule("system.runtime.c.limits");
	explorer.packageExplorer.addModule("system.runtime.c.locale");
	explorer.packageExplorer.addModule("system.runtime.c.math");
	explorer.packageExplorer.addModule("system.runtime.c.signal");
	explorer.packageExplorer.addModule("system.runtime.c.stdarg");
	explorer.packageExplorer.addModule("system.runtime.c.stddef");
	explorer.packageExplorer.addModule("system.runtime.c.stdint");
	explorer.packageExplorer.addModule("system.runtime.c.stdio");
	explorer.packageExplorer.addModule("system.runtime.c.stdlib");
	explorer.packageExplorer.addModule("system.runtime.c.string");
	explorer.packageExplorer.addModule("system.runtime.c.time");
	explorer.packageExplorer.addModule("system.runtime.c.wctype");
	explorer.packageExplorer.addModule("system.text.UTF");
	explorer.packageExplorer.addModule("system.threading.Atomic");
	explorer.packageExplorer.addModule("system.threading.ThreadUtility");
	explorer.packageExplorer.addModule("system.threading.synchronization.SpinWait");
	explorer.packageExplorer.addModule("system.collections.ArrayList");
	explorer.packageExplorer.addModule("system.collections.Comparer");
	explorer.packageExplorer.addModule("system.collections.Deque");
	explorer.packageExplorer.addModule("system.collections.EqualityComparer");
	explorer.packageExplorer.addModule("system.collections.Exception");
	explorer.packageExplorer.addModule("system.collections.HashMap");
	explorer.packageExplorer.addModule("system.collections.HashSet");
	explorer.packageExplorer.addModule("system.collections.ICollection");
	explorer.packageExplorer.addModule("system.collections.IComparer");
	explorer.packageExplorer.addModule("system.collections.IDeque");
	explorer.packageExplorer.addModule("system.collections.IEnumerable");
	explorer.packageExplorer.addModule("system.collections.IEnumerator");
	explorer.packageExplorer.addModule("system.collections.IEqualityComparer");
	explorer.packageExplorer.addModule("system.collections.IList");
	explorer.packageExplorer.addModule("system.collections.IMap");
	explorer.packageExplorer.addModule("system.collections.IQueue");
	explorer.packageExplorer.addModule("system.collections.LinkedList");
	explorer.packageExplorer.addModule("system.collections.Pair");
	explorer.packageExplorer.addModule("system.collections.PrimeHelper");
	explorer.packageExplorer.addModule("system.collections.PriorityQueue");
	explorer.packageExplorer.addModule("system.collections.Queue");
	explorer.packageExplorer.addModule("system.collections.RBTree");
	explorer.packageExplorer.addModule("system.collections.Stack");
	explorer.packageExplorer.addModule("system.collections.TreeMap");
	explorer.packageExplorer.addModule("system.collections.TreeSet");
	explorer.packageExplorer.addModule("system.collections.objectmodel.ListCollection");
	explorer.packageExplorer.addModule("system.collections.objectmodel.ReadOnlyListCollection");</script>
</body></html>


